import 'package:flutter/material.dart';
import 'package:my_test_demo/constant/router_constant.dart';

import '../constant/constant.dart';

class SplashPage extends StatefulWidget {
  const SplashPage({super.key});

  @override
  SplashPageState createState() {
    return SplashPageState();
  }
}

class SplashPageState extends State<SplashPage> {

  @override
  void initState() {
    super.initState();
    downTime();
  }

  void downTime() {
    Future.delayed(Duration(seconds: 1), () {
      Navigator.pop(context);
      //路由跳转
      Navigator.pushNamed(context, RouterConstant.LOGIN);
    });
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      backgroundColor: Colors.white,
      body: Column(
        children: <Widget>[
          Row(
            children: <Widget>[
              Expanded(
                child: Container(
                  alignment: Alignment.center,
                  margin: EdgeInsets.only(top: 100),
                  color: Color(0xFFFFFFFF),
                  child: Image.asset(
                    '${Constant.ASSETS_IMG}welcome_android_slogan.png',
                    width: 200.0,
                    height: 100.0,
                  ),
                ),
              ),
            ],
          ),
          Expanded(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.end,
              children: <Widget>[
                Container(
                  alignment: Alignment.center,
                  color: Color(0xFFFFFFFF),
                  child: Image.asset(
                    '${Constant.ASSETS_IMG}welcome_android_logo.png',
                    width: 100.0,
                    height: 100.0,
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
